package com.ld.xuanKe.controller;

import com.ld.xuanKe.service.TeachingClassService;
import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @ProjectName xuanKe
 * @ClassName TeacherClassAction
 * @Author 刘邓
 * @Date 2023-12-22 19:20
 */
@Controller
@Scope("prototype")
public class TeachingClassAction {
	@Resource
	private TeachingClassService teachingClassService;
	public String add(){
		int i = teachingClassService.addList();
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpSession session = request.getSession();
		if(i == 0){
			session.setAttribute("message", "生成失败");
		}else{
			session.setAttribute("message", "生成成功");
		}
		return "teachingClass-add";
	}
}
